package fr.flogo.destinee.cameras;

import javax.microedition.khronos.opengles.GL10;

import android.opengl.GLU;

import fr.flogo.destinee.positions.Vector3D;

public class IsometricSimpleCamera implements ICamera {

	private Vector3D position = new Vector3D(0d, 0d, 0d);
	private Vector3D direction = new Vector3D(0d, 0d, 0d);
	
	public IsometricSimpleCamera() {
		
	}
	
	@Override
	public void translate(GL10 gl, float x, float y, float z) {
		this.position = new Vector3D(x, y, z);
	}

	@Override
	public void rotation(GL10 gl, float angle, float x, float y, float z) {
		// TODO Auto-generated method stub

	}

	@Override
	public float[] getPosition() {
	float[] position = new float[3];
	position[0] = (float) this.position.getX();
	position[1] = (float) this.position.getY();
	position[2] = (float) this.position.getZ();
	
	
		return position;
	}

	@Override
	public void turn(float angle, float x, float y, float z) {
		// TODO Auto-generated method stub

	}

	@Override
	public void move(float x, float y, float z) {
		this.position.move(x, y, z);
//		this.position.setX(this.position.getX()-0.2f);
	}

	@Override
	public void drawMovement(GL10 gl) {
		gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);

		gl.glMatrixMode(GL10.GL_MODELVIEW);
		// Reset the Modelview Matrix
		gl.glLoadIdentity();

		
		
//		this.position.setY(-20f);
		GLU.gluLookAt(gl, (float)this.position.getX(), (float)this.position.getY(), (float)this.position.getZ(), 0f, 0f, 0f, 0f, 0f, 1f);

		System.out.println("Position : ["+this.position.getX()+"f, "+this.position.getY()+"f, "+this.position.getZ()+"f]");
	}
	
	private float rotate = 0.0f;

}
